Ext.define('Admin.view.main.Main', {
    extend: 'Ext.container.Viewport',
    requires: [
        'Admin.view.*'
    ],
    reference: 'mainView',
    controller: 'main',
    viewModel: 'main',
    cls: 'sencha-dash-viewport',
    // itemId: 'mainView',
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    listeners: {
        render: 'onMainViewRender'
    },
    // minWidth:1280,//还需要做成小于1280底部有滚动条
    height: 200,
    items: [
        //顶部导航
        {
            xtype: 'toolbar',
            cls: 'sencha-dash-dash-headerbar shadow',
            height: 65,
            bodyStyle: {
                overflow: 'visible'
            },
            // itemId: 'headerBar',
            items: [{
                    xtype: 'component',
                    reference: 'senchaLogo',
                    cls: 'sencha-logo',
                    width: 540,
                    initComponent: function() {
                        this.html = ' <div class="main-logo logo"  ' +
                            'style="font-size: 25px;font-family: 微软雅黑;' +
                            'color: #fff;font-weight: bold;">' +
                            '<b>水资源调配决策支持系统</b> <b>|</b>' +
                            // '<span class="fuhe-nav-title-name" style="font-size:18px;font-weight:normal">'+
                            // '<span>' +(config.RIVER === '02' ? '  抚河流域':'  袁河流域') +'</span>'+
                            // '<ul class="fuhe-nav-link-ul">'+
                            // // '<li class="fuhe-nav-link-li" id="fuhe-btn"><a href="http://123.85.3.50:8079/jsite-szy-dispatch/#gisMapTest">袁河流域</a></li>'+
                            // // '<li class="fuhe-nav-link-li" id="yuanhe-btn"><a href="http://m.itwinkle.com.cn:81/jxszy-app/index.html#map">赣江南昌段</a></li>'+
                            // '<li class="fuhe-nav-link-li" id="fuhe-btn"><a href="javascript:void(0)">抚河流域</a></li>'+
                            // '<li class="fuhe-nav-link-li" id="yuanhe-btn"><a href="javascript:void(0)">袁河流域</a></li>'+
                            // '</ul>'+
                            // '</span>'+
                            '<span><ul style="display: inline-block;height: 33px;margin: 0 0 0 8px;"><li role="presentation" class="dropdown">' +
                            '<a class="dropdown-toggle" style="color: #fff;font-size:18px;font-weight:normal" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">' +
                            (config.RIVER === '02' ? '  抚河流域' : '  袁河流域') + '&nbsp;&nbsp;<span class="caret"></span>' +
                            '</a><ul class="dropdown-menu" style="top: 75%;min-width: 60px;">' +
                            '<li class="fuhe-nav-link-li" id="fuhe-btn"><a href="javascript:void(0)">抚河流域</a></li>' +
                            '<li class="fuhe-nav-link-li" id="yuanhe-btn"><a href="javascript:void(0)">袁河流域</a></li>' +
                            '</ul></li></ul></span>' +
                            '</div>';

                    },
                    afterRender: function() {
                        $('#fuhe-btn').on('click', function() {
                            if (sessionStorage.RIVER === "02") return;
                            sessionStorage.RIVER = "02";
                            location.reload();
                        });
                        $('#yuanhe-btn').on('click', function() {
                            if (sessionStorage.RIVER === "03") return;
                            sessionStorage.RIVER = "03";
                            location.reload();
                        });
                    },
                },
                {
                    xtype: 'segmentedbutton',
                    height: '100%',
                    // width: '630px',
                    reference: 'topBtnList',
                    cls: 'topBtnList my-top-nav',
                    style: {
                        'font-size': 20,
                    },
                    items: [
                        //     {
                        //     topId: 'infor',
                        //     text: '信息服务',
                        //     iconAlign: 'top',
                        //     iconCls: 'x-fa fa-map-o',
                        // }, {
                        //     topId: 'dispatch',
                        //     text: '常规调度',
                        //     iconAlign: 'top',
                        //     iconCls: 'x-fa fa-desktop'
                        // }, {
                        //     topId: 'warn',
                        //     text: '应急调度',
                        //     iconAlign: 'top',
                        //     iconCls: 'x-fa  fa-paper-plane-o'
                        // }, {
                        //     topId: 'meeting',
                        //     text: '会商决策',
                        //     iconAlign: 'top',
                        //     iconCls: 'x-fa fa-comments-o'
                        // }, {
                        //     topId: 'eval',
                        //     text: '水资源评价',
                        //     iconAlign: 'top',
                        //     iconCls: 'x-fa fa-bookmark-o'
                        // }, {
                        //     topId: 'sys',
                        //     text: '系统管理',
                        //     iconAlign: 'top',
                        //     iconCls: 'x-fa fa-cogs'
                        // }
                    ],
                    listeners: {
                        toggle: 'onMainMenuToggle'
                    }
                }, '->', {
                    xtype: 'component',
                    html: '<div style = "padding-right:30px;">' +
                        '<div style="width:37px; height:37px;margin-top:4px;border-radius:50%; overflow:hidden;">' +
                        '<img src="resources/images/fh/avatar.png" alt="用户头像" />' +
                        '</div>' +
                        '<div style = "margin-top:4px;color:white;">管理员</div>' +
                        '</div>',
                }
            ]
        },
        //左侧导航
        {
            xtype: 'maincontainerwrap',
            id: 'main-view-detail-wrap',
            reference: 'mainContainerWrap',
            flex: 1,
            items: [{
                    xtype: 'treelist',
                    reference: 'navigationTreeList',
                    itemId: 'navigationTreeList',
                    ui: 'navigation',
                    store: 'NavigationTree',
                    width: 250,
                    expanderFirst: false,
                    expanderOnly: false,
                    listeners: {
                        selectionchange: 'onNavigationTreeSelectionChange'
                    }
                },
                {
                    xtype: 'container',
                    flex: 1,
                    reference: 'mainCardPanel',
                    cls: 'sencha-dash-right-main-container',
                    // itemId: 'contentPanel',
                    layout: {
                        type: 'card',
                        align: 'stretch'
                    },
                }
            ]
        }
    ]
});